<template>
    <!-- <div class="stat-info">
        <div class="stat-item">
            <a-row>
                <a-col :span="4" :offset="8">
                    <a-icon type="exclamation-circle" :style="{ fontSize: '36px' }" />
                </a-col>
                <a-col :span="8">节点数: 4</a-col>
            </a-row>
        </div>
        <div class="stat-item">
            <a-icon type="exclamation-circle" :style="{ fontSize: '36px' }" />
            节点数: 4
        </div>
        <div class="stat-item">
            <a-icon type="exclamation-circle" :style="{ fontSize: '36px' }" />
            节点数: 4
        </div>
        <div class="stat-item">
            <a-icon type="exclamation-circle" :style="{ fontSize: '36px' }" />
            节点数: 4
        </div>
    </div> -->
    <div style="padding: 30px 100px;">
        <a-row justify="space-around" align="middle" :gutter="5">
            <a-col :span="6">
                <div class="stat-info stat-info-bg1">
                    <div class="stat-item-left">
                        <a-icon type="compass" :style="{ fontSize: '60px' }" />
                    </div>
                    <div class="stat-item-right">
                        <div class="stat-item-right-number">{{ nodeNumber }}</div>
                        <div class="stat-item-right-title">节点数</div>
                    </div>
                </div>
            </a-col>
            <a-col :span="6">
                <div class="stat-info stat-info-bg2">
                    <div class="stat-item-left">
                        <a-icon type="build" :style="{ fontSize: '60px' }" />
                    </div>
                    <div class="stat-item-right">
                        <div class="stat-item-right-number">{{ blockNumber }}</div>
                        <div class="stat-item-right-title">区块数</div>
                    </div>
                </div>
            </a-col>
            <a-col :span="6">
                <div class="stat-info stat-info-bg3">
                    <div class="stat-item-left">
                        <a-icon type="account-book" :style="{ fontSize: '60px' }" />
                    </div>
                    <div class="stat-item-right">
                        <div class="stat-item-right-number">{{ txNumber }}</div>
                        <div class="stat-item-right-title">交易数</div>
                    </div>
                </div>
            </a-col>
            <a-col :span="6">
                <div class="stat-info stat-info-bg4">
                    <div class="stat-item-left">
                        <a-icon type="database" :style="{ fontSize: '60px' }" />
                    </div>
                    <div class="stat-item-right">
                        <div class="stat-item-right-number">{{ contractNumber }}</div>
                        <div class="stat-item-right-title">合约数</div>
                    </div>
                </div>
            </a-col>

        </a-row>
    </div>

</template>

<script>
import Constant from "../utils/Constant";

export default {
    data() {
        return {
            nodeNumber: 0,
            blockNumber: 0,
            txNumber: 0,
            contractNumber: 0
        }
    },
    created() {
        this.getStatData();
    },
    methods: {
        async getStatData() {
            let url = Constant.INDEX_DATA_URL;
            let resp = await this.$http.get(url);
            console.log(resp);
            if (resp.data.code === "01") {
                this.nodeNumber = resp.data.result.nodeNumber;
                this.blockNumber = resp.data.result.blockNumber;
                this.txNumber = resp.data.result.txNumber;
                this.contractNumber = resp.data.result.contractNumber;
            }
        }
    }
}
</script>

<style scoped>
.stat-info {
    width: 100%;
    height: 300px;
    text-align: center;
    color: #fff;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
}

.stat-info:hover {
    box-shadow: 0px 0px 10px 0px rgb(70, 61, 61);
}

.stat-info-bg1 {
    background-image: linear-gradient(45deg, #8299b8, #5b94b9, #7da4eb);

}

.stat-info-bg2 {
    background-image: linear-gradient(90deg, #8299b8, #5b94b9, #7da4eb);
}

.stat-info-bg3 {
    background-image: linear-gradient(135deg, #8299b8, #5b94b9, #7da4eb);
}

.stat-info-bg4 {
    background-image: linear-gradient(180deg, #8299b8, #5b94b9, #7da4eb);
}

.stat-item-left {

    padding: 110px 10px;
    width: 50%;
    text-align: right;
}

.stat-item-right {

    padding: 110px 10px;
    line-height: 30px;
    width: 50%;
    text-align: left;
}

.stat-item-right-number {
    font-size: 40px;
    font-weight: bold;
}

.stat-item-right-title {
    font-size: 16px;
    color: #e4e4db;
}
</style>
